<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path+ "/";
%>
<!DOCTYPE html>
<html class="no-js">
<head>
  <meta charset="UTF-8">
  <title>二维码</title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="format-detection" content="telephone=no">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <jsp:include page="/jsp/inc.jsp"></jsp:include>
</head>
<body>
<div class="content">
    <!-- <span class="Num">8888&nbsp;8888&nbsp;8888&nbsp;8888888</span> -->
    <div class="TiaoMa"  id="bcTarget"></div>
    <input class="valData Num" value="${orderCode}">
    <div class="WeiMa">
        <div id="code"></div>
    </div>
    <div class="codetip">请将此二维码提供给工作人员</div>
</div>

<!-- 测试元素 start-->
<!-- <span onclick='code39()'>点我点我点我点我点我点我点我</span> -->

<!-- 测试元素 end-->
<script type="text/javascript">
    function code39(){
        $("#bcTarget").empty().barcode($(".valData").val(), "code39",{barWidth:1, barHeight:60,showHRI:false});
    }
    code39();
</script>

<script type="text/javascript">
//    $(function(){
        // 生成二维码
        var str = "${orderCode}";  //二维码数据
        var offsetWidth=document.body.offsetWidth;
        // 二维码不同手机屏幕适配
        if(offsetWidth<=1242){//针对iphone 6 plus
            $('#code').qrcode({
                render: "table",
                text: str,
                width:130,
                height:130
            });
        }else if(offsetWidth<=360){
            $('#code').qrcode({
                render: "table",
                text: str,
                width:80,
                height:80
            });
        }else if(offsetWidth==384){
            $('#code').qrcode({
                render: "table",
                text: str,
                width:130,
                height:130
            });
        }else{
            $('#code').qrcode({
                render: "table",
                text: str
            });
        }
//    })
    // 文字转二维码函数
    function toUtf8(str) {
        var out, i, len, c;
        out = "";
        len = str.length;
        for(i = 0; i < len; i++) {
            c = str.charCodeAt(i);
            if ((c >= 0x0001) && (c <= 0x007F)) {
                out += str.charAt(i);
            } else if (c > 0x07FF) {
                out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
                out += String.fromCharCode(0x80 | ((c >>  6) & 0x3F));
                out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));
            } else {
                out += String.fromCharCode(0xC0 | ((c >>  6) & 0x1F));
                out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));
            }
        }
        return out;
    }
</script>
</body>
</html>

